<?php
/**
 * Minhlog Domain_Model 页面类
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 *
 * @category   Domain
 * @package    Domain_Model
 * @copyright  Copyright (c) 2009-2010 Minh.Shu@gmail.com
 * @license    New BSD License
 * @author     Minh.Shu
 * @version    $Id: Page.php 2 2010-01-17 13:49:08Z Minh.Shu $
 *
 */

class Domain_Model_Page
{
    private $_pageDataMapper;
    private $_pageEntity;

    public function  __construct()
    {
        $this->_pageDataMapper = new Domain_DataMapper_Page();
        $this->_pageEntity = new Domain_Entity_Page();
        $this->_pageDataMapper->setEntity($this->_pageEntity);
    }

    /**
     * 获取全部页面信息
     * @return object|void
     */
    public function getAllPage()
    {
        $resultSet = $this->_pageDataMapper->findAllPage();
        return $resultSet;
    }

    /**
     * 根据主键ID查询页面
     * @param integer $pageId
     * @return object|void
     */
    public function getPageById($pageId)
    {
        $pageId = (int) $pageId;
        $resultSet = $this->_pageDataMapper->findByPrimaryId($pageId);
        return $resultSet;
    }

    /**
     * 保存页面信息
     * @param array $pageData
     * @param integer $primaryId
     * @return
     */
    public function savePage($pageData, $primaryId = 0)
    {
        $primaryId = (int) $primaryId;
        return $this->_pageDataMapper->save($pageData, $primaryId);
    }

    /**
     * 删除页面信息
     * @param integer $primaryId
     * @return
     */
    public function delPage($primaryId)
    {
        $primaryId = (int) $primaryId;
        return $this->_pageDataMapper->delete($primaryId);
    }
}